import request from '@/utils/request'
import processRichText from "@/utils/processRichText"
import { ref } from 'vue'
export default () => {
	const personalcourses = ref([])
	const personalcourse = ref({})
	const getPersonalCourse = async (show_mini) => {
		personalcourses.value = await request.get(`mini/personalcourse/list?show_mini=${show_mini}`)
		// console.log(personalcourses.value)
	}
	const loadPersonalcourse = async (id) => {
		let data  = await request.get(`mini/personalcourse/${id}/one`)
		data.introduction = processRichText(data.introduction)
		personalcourse.value = data
	}
	return {
		getPersonalCourse,
		personalcourses,
		loadPersonalcourse,
		personalcourse,
	}
}